import { GET, POST } from '../../request';
import * as Types from './index.d';

/**
 * 获取订单详情
 * @param params
 * @returns
 */
export const getOrderInfo = (
  params: Types.IGetOrderInfoParams,
): Promise<Types.IGetOrderInfoRes> => {
  return GET('/user/info', { ...params });
};
/**
 * 保存联系人信息
 * @param params
 * @returns
 */
export const saveReceiver = (
  params: Types.IGetOrderInfoParams,
): Promise<Types.IGetOrderInfoRes> => {
  return POST('/user/info', { ...params });
};

/**
 * 创建订单
 * @returns
 */
export const createOrder = (params: any): Promise<any> => {
  return GET('/api/create_order_goods_or_services', { ...params });
};

/**
 * 创建秒杀订单
 * @returns
 */
export const createMiaoshaOrder = (params: any): Promise<any> => {
  return GET('/api/create_order_seckill', { ...params });
};

/**
 * 获取我的订单列表
 * @param type 1商品 2服务  4秒杀
 */
export const getOrderListInfo = (params: any): Promise<any> => {
  return GET('/api/get_order_list', { ...params });
};

/**
 * 获取订单详情
 * @param  order_sn
 */
export const getOrderDetail = (params: any): Promise<any> => {
  return GET('/api/get_order_detail', { ...params });
};

/**
 * 取消订单
 * @param  order_sn
 */
export const cancelOrder = (params: any): Promise<any> => {
  return GET('/api/cancel_order', { ...params });
};
/**
 * 支付订单
 * @param  order_sn
 */
export const payOrder = (params: any): Promise<any> => {
  return GET('/api/pay_order', { ...params });
};

/**
 * 购买会员
 */
export const buyVip = (params: any): Promise<any> => {
  return GET('/api/add_vip', { ...params });
};

/**
 * 申请退款
 */
export const reqRefound = (params: any) => {
  return GET('/api/pay_refund', params);
};

/**
 * 确认收货
 */
 export const confirmOrder = (params: any) => {
  return GET('/api/confirm_order', params);
};
